package com.xx.job.Controller;

import com.xx.job.common.CommonResult;
import com.xx.job.entity.Payment;
import com.xx.job.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/payment")
public class PaymentController {

    @Autowired
    private PaymentService paymentService;

    @Value("${server.port}")
    private String port;


    @GetMapping("/get/{id}")
    public String get(@PathVariable Long id){
        Payment payment = paymentService.selectById(id);
        return port;
    }

    @GetMapping("/selectById/{id}")
    public CommonResult selectById(@PathVariable Long id){
        Payment payment = paymentService.selectById(id);
        System.out.println("port:"+port);
        return new CommonResult(200,"操作成功"+port,payment);
    }

    @PostMapping("/insert")
    public CommonResult insert(@RequestBody Payment payment){
        int i = paymentService.create(payment);
        return new CommonResult(200,"操作成功");
    }
}
